<html>
<head><meta charset="utf-8"><title>trailing `&gt;` · t-compiler/wg-diagnostics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/index.html">t-compiler/wg-diagnostics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/trailing.20.60.3E.60.html">trailing `&gt;`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="156566414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/trailing%20%60%3E%60/near/156566414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/trailing.20.60.3E.60.html#156566414">(Jan 21 2019 at 22:59)</a>:</h4>
<p><span class="user-mention" data-user-id="119031">@Esteban Küber</span> I'm working on the <code>Foo::&lt;Bar&gt;::Baz</code> case: I've got something that works by calling our trailing <code>&gt;</code> check after <a href="https://github.com/rust-lang/rust/blob/7164a9f151a56316a382d8bc2b15ccf373e129ca/src/libsyntax/parse/parser.rs#L2152" target="_blank" title="https://github.com/rust-lang/rust/blob/7164a9f151a56316a382d8bc2b15ccf373e129ca/src/libsyntax/parse/parser.rs#L2152">this line</a> - however, as <code>parse_path_segment</code> can indirectly end up calling <code>parse_path_segments</code> (the function we're modifying), it causes some difficulty.</p>
<p>That is, given <code>Foo::&lt;Bar as Baz&lt;T&gt;&gt;::Qux</code>, we parse until <code>Foo::&lt;</code> where it will call <code>parse_path_segments</code> and then our check directly afterwards. Parsing the inside of the <code>&lt;..&gt;</code> results in us getting to <code>Foo::&lt;Bar as Baz&lt;</code> when we end up calling <code>parse_path_segments</code> again and our check directly afterwards. When that call returns, we are at <code>Foo::&lt;Bar as Baz&lt;T&gt;</code> and the check concludes that the correct <code>&gt;</code> that follows is in fact trailing. What we want to happen is execute our check after <code>parse_path_segments</code> only on the first invocation and not on any subsequent recursions. </p>
<p>I've achieved this by checking if <code>style == PathStyle::Expr</code> - however, I'm not sure if it is an invariant of that style that it won't ever be used in a call from a recursion. Do you know if that is the case?</p>



<a name="156568320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/trailing%20%60%3E%60/near/156568320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/trailing.20.60.3E.60.html#156568320">(Jan 21 2019 at 23:44)</a>:</h4>
<p>More concretely, <a href="https://github.com/rust-lang/rust/pull/57817#discussion_r249604006" target="_blank" title="https://github.com/rust-lang/rust/pull/57817#discussion_r249604006">see this review comment</a>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>